<template>
  <div id="app">
    <c-header :title="$route.meta.title" />
    <transition :name="transitionName">
      <keep-alive :include="[]">
        <router-view />
      </keep-alive>
    </transition>

    <menu-nav></menu-nav>
  </div>
</template>

<script>
import { mapState } from "vuex";
import MenuNav from "./components/menu";
import CHeader from "components/header";
import { getRemoteSessionBySessionId } from "@/api/user";
import utils from "./tools/utils";
export default {
  name: "App",
  components: {
    MenuNav,
    CHeader,
  },
  data() {
    return {
      transitionName: "",
      timer: null, // 定时器
    };
  },
  created() {},
  destroyed() {
    clearInterval(this.timer);
  },
  computed: {},
  watch: {
    // 使用watch 监听$router的变化
    $route(to, from) {
      // 如果to索引大于from索引,判断为前进状态,反之则为后退状态
      if (to.meta.index > from.meta.index || !from.meta.index) {
        // 设置动画名称
        this.transitionName = "slide-left";
      } else {
        this.transitionName = "slide-right";
      }
    },
  },
};
</script>

<style lang="scss">
html,
body {
  height: 100%;
}
body {
  margin: 0 !important;
  position: absolute;
}
.van-toast {
  width: auto !important;
}
.el-select-dropdown {
  left: 30px !important;
  width: calc(100% - 60px) !important;
  .el-select-dropdown__item {
    font-weight: 400;
    font-size: 26px;
    line-height: 36px;
    padding: 10px 20px;
    height: auto;
  }
}
.van-dialog {
  .van-dialog__confirm {
    color: #13c093;
  }
}
#app {
  width: 640px;
  height: 100%;
  // height: 100vh;
  // min-height: 100vh;
  font-size: 30px;
  margin: 0 auto;
  position: absolute;
  background: #fff;
  // overflow-x: hidden;
  .container {
    top: 96px;
    width: 100%;
    position: absolute;
    left: 0px;
    right: 0px;
    bottom: 0px;
    overflow-y: auto;
    padding-bottom: 0.2rem;
    -webkit-overflow-scrolling: touch;
    overflow-scrolling: touch;
    @include flex($flex-flow: column, $justify-content: flex-start);
  }
}
.hide-header .container {
  // top: 10px !important;
  top: 0 !important;
}
.slide-right-enter-active,
.slide-right-leave-active,
.slide-left-enter-active,
.slide-left-leave-active {
  will-change: transform;
  transition: all 300ms;
  position: absolute;
}
.slide-right-enter {
  opacity: 0;
  transform: translate3d(-100%, 0, 0);
}
.slide-right-leave-active {
  opacity: 0;
  transform: translate3d(100%, 0, 0);
}
.slide-left-enter {
  opacity: 0;
  transform: translate3d(100%, 0, 0);
}
.slide-left-leave-active {
  opacity: 0;
  transform: translate3d(-100%, 0, 0);
}
.van-dialog .van-dialog__content .van-dialog__message {
  line-height: 0.4rem;
}
.van-notify.van-notify {
  line-height: 40px;
  font-size: 22px;
}
.el-timeline-item__node--normal {
  top: 0.12rem;
}

.el-timeline-item__wrapper {
  font-size: 0.18rem;
  .el-timeline-item__timestamp {
    font-size: 0.16rem;
    margin-bottom: 0.18rem;
    padding-top: 0.14rem;
  }
  .is-top {
    margin-bottom: 0.18rem !important;
    padding-top: 0.14rem !important;
  }
}
</style>
